﻿;/////////////////////////////////////////////////////////////;
;                                                             ;
;                 SimpleDX11 modul procedures                 ;
;                                                             ;
;                                                             ;
;                   (c) 2013 SimpleDX Team                    ;
;                                                             ;
;                         License: MIT                        ;
;                                                             ;
;/////////////////////////////////////////////////////////////; 

;-//    Private Macro         //
Macro GetColorFloats()
  Protected tmpR.i = (ColorValue & $ff)          : *color\r = tmpR / 255
  Protected tmpG.i = ((ColorValue >> 8) & $ff)   : *color\g = tmpG / 255
  Protected tmpB.i = ((ColorValue >> 16) & $ff)  : *color\b = tmpB / 255
  Protected tmpA.i = ((ColorValue >> 24) & $ff)  : *color\a = tmpA / 255
EndMacro

; Creates an Identity matrix
Procedure.l MatrixIdentity(*Matrix.D3DMATRIX)  

   *Matrix\_11 = 1.0 : *Matrix\_12 = 0.0 : *Matrix\_13 = 0.0 : *Matrix\_14 = 0.0
   *Matrix\_21 = 1.0 : *Matrix\_22 = 0.0 : *Matrix\_23 = 0.0 : *Matrix\_24 = 0.0
   *Matrix\_31 = 1.0 : *Matrix\_32 = 0.0 : *Matrix\_33 = 0.0 : *Matrix\_34 = 0.0
   *Matrix\_41 = 1.0 : *Matrix\_42 = 0.0 : *Matrix\_43 = 0.0 : *Matrix\_44 = 0.0
   
   
 EndProcedure
 
 
; String to ByteString  
Procedure.l StringToByteString(String$)
    strLen.l = Len(String$)  
    *newStr = AllocateMemory(strLen + 1) 
    CompilerSelect #PB_Compiler_Unicode
      CompilerCase 1  
        WideCharToMultiByte_(#CP_ACP, #Null, String$, strLen ,  *newStr, strLen, #Null, #Null);
        ProcedureReturn *newStr
      CompilerDefault
        CopyMemory(@String$, *newStr, strLen)
        ProcedureReturn *newStr
    CompilerEndSelect    
EndProcedure
; IDE Options = PureBasic 5.20 beta 14 LTS (Windows - x64)
; CursorPosition = 12
; Folding = -
; EnableUnicode
; EnableXP